﻿using d1Project.Modules.Business.doXZ.Migrations;
using d1Project.Modules.Business.doXZ.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace d1Project.Modules.Business.doXZ
{
    public class doXZDbContext:DbContext
    {
        static doXZDbContext()
        {
            //Database.SetInitializer<doXZDbContext>(new ApplicationDbInitializer());
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<doXZDbContext, doXZDbConfig>());
        }
        public doXZDbContext()
            : base(DoEnvironment.DefaultDbName)
        {
            this.Configuration.LazyLoadingEnabled = false;
        }

        //-------------------------------------------------------------------------------       

        public DbSet<XZ_GswhModel> XZ_Gswh { get; set; }
        public DbSet<XZ_XlTypeModel>XZ_XlType{ get; set; }
        public DbSet<XZ_QyType> XZ_QyType { get; set; }
        public DbSet<XZ_model> XZ_model { get; set; }
        public DbSet<XZ_DbjlModel> XZ_Dbjl { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.HasDefaultSchema("dbo");
        }

        public class ApplicationDbInitializer : CreateDatabaseIfNotExists<doXZDbContext>
        {
            protected override void Seed(doXZDbContext context)
            {
                base.Seed(context);

            }
        }
    }
}